import java.util.HashMap;
import java.util.Map;
//具体中介者
public class ConcreteMediator implements Mediator{
    private Map<String,Colleague> colleagueMap = new HashMap<String,Colleague>();
    @Override
    public void register(String colleagueName, Colleague colleague) {
        colleagueMap.put(colleagueName, colleague);
    }
    @Override
    public void relay(String colleagueName, String message) {
        Colleague colleague = colleagueMap.get(colleagueName);
        if (colleague!=null) {
            colleague.receive(message);
        }
    }
}
